<?php

namespace Bigspender\DefaultBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;

class UserEditType extends AbstractType
{
    private $name;
    private $email;

    public function __construct($name, $email) 
    {
        $this->name     = $name;
        $this->email    = $email;
    }

    public function buildForm(FormBuilderInterface $builder, array $options)
    {
    	$builder->add(
            'name', 
            'text', 
            array(
                'required' => true, 
                'attr' => 
                    array(
                        'class' => 'form-control',
                        'value' => $this->name
                    )
            )
        );

        $builder->add(
            'email', 
            'email', 
            array(
                'required' => true, 
                'attr' => 
                    array(
                        'class' => 'form-control',
                        'email' => $this->email
                    )
            )
        );

        $builder->add(
            'send', 
            'submit', 
            array(
                'attr' => 
                    array(
                        'class' => 'btn btn-success'
                    )
            )
        );
    }

    public function getName()
    {
        return 'user-edit';
    }
}
